<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@page import="crm.model.Employees"%>
<%@page import="crm.util.GetBaseParam"%>
<%@page import="crm.util.ParamUtil"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../../resources/css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../../resources/css/inner.css" type="text/css" media="screen" />
<link href="../../../resources/validation/css/formitem.css" rel="stylesheet" type="text/css" />
<style type="text/css">
html{overflow-y:scroll}
</style>
		<title>跟单添加页面</title>
	</head>
	<link type="text/css"
		href="../../../resources/css/jquery-ui-1.8.16.custom.css"
		rel="stylesheet" />
	<script type="text/javascript"
		src="../../../resources/js/jquery-1.6.2.min.js"></script>
	<script type="text/javascript"
		src="../../../resources/js/jquery-ui-1.8.16.custom.min.js"></script>
	<script type="text/javascript"
		src="../../../resources/js/WebCalendar.js"></script>
	<script type="text/javascript">
<!--
 function openwin(url,wwidth,wheight) 
 {
  var x=(screen.Width-wwidth)/2;
  var y=(screen.Height-wheight)/2;
  window.open(url, 'upload_photo', 'toolbars=0, scrollbars=0, location=0, statusbars=0, menubars=0, resizable=0, width='+wwidth+', height='+wheight+', left='+x+', top='+y);
 }
//-->
</script>
    <script type="text/javascript">
    $(function(){
             $("#title").keyup(function(){
                  if($("#title").val()!=null){
                      $.ajax({
                         type : "get",
                         cache : false,
                         url : "recepit_is_exist.jsp",
                         dataType : "html",
                         data : {
                         title : $("#title").val()
                         },
                         success : function(data){
                            if(data == 0){
                            	$("#title")
                            	.addClass('right-style')
                            	$("#tip").css('color','#76B700')
                            	.html('该跟单名称可以使用');
x                            } else {
                            	$("#title")
                            	.removeClass('right-style') 
                   				.addClass('error-style')
                   				$("#tip").css('color','#C6533C')
                            	.html('该跟单项目已存在');
                            }
                         }
                      })
                  }
                  else{return false;}
             })
    })
    </script>
	<script type="text/javascript">
  $(function(){
		$("#consumerName").focus(function(){
			if($("#consumerId").val() !=null ){
				$.ajax( {
					type : "get",
					cache : false,
					url : "get_linkman_list.jsp",
					dataType : "html",
					data : {
					consumer : $('#consumerId').val()
					},
					success : function(data) {
						$('#linkman_list').html(data);
					}
				})
			}
			else{
	              return false;
					}
		})   
	  })
  </script>
 <style type='text/css'>
  a{font-size:12px; text-decoration:none; color:#70B300;}
 </style>
	<body style='height:680px;'>
		<%
         Employees cu = (Employees)session.getAttribute("user");
		//String cName= (String)session.getAttribute("cName");
		//String cid = (String) session.getAttribute("cId");
		//session.removeAttribute("cName");
		//session.removeAttribute("cId");
		
   %>
		<form action="recepit_add_do.jsp" method="post">
			<table>
				<tr>
					<td>
						跟单项目名称
					</td>
					<td>
						<input type="text" name="title" id="title" value=""/>&nbsp;&nbsp;<span id='tip'></span>
					</td>
				</tr>
				<tr>
					<td>
						客户
					</td>
					<td>
						<input type="text" id="consumerName" value=""
							onclick="openwin('select_consumers.jsp?id=<%=cu.getId() %>',500,900)"/ >
						<input type="hidden" name="consumer" id="consumerId">
					</td>
				</tr>
				<tr>
					<td>
						客户联系人
					</td>
					<td>
						<select id="linkman_list" name="linkman_id"></select>
					</td>
					</tr><tr>
					<td>
						创建人
					</td>
					<td>
						<input type="text" name="creator" value="<%=cu.getName() %>"
							readonly>
					</td>
				</tr>
				<tr>
					<td>
						跟单意向
					</td>
					<td>
						<select name="intention">
							<%  
           HashMap intentions = GetBaseParam.getAllIntentions();
          Iterator it = intentions.entrySet().iterator();
          while(it.hasNext()){
    	       Map.Entry entry = (Map.Entry)it.next();
    	  %>
							<option value="<%=entry.getKey() %>"><%=entry.getValue() %></option>
							<%
      }%>
						</select>
					</td>
				</tr>
				<tr>
					<td>
						分类
					</td>
					<td>
						<input type="radio" value="0" name="sort" checked>
						一般
						<input type="radio" value="1" name="sort">
						重要
					</td>
				</tr>
				<tr>
					<td>
						跟单阶段
					</td>
					<td>
						<select name="stage">
							<%  
        HashMap stages = GetBaseParam.getAllRecepitStages();
       Iterator it2 = stages.entrySet().iterator();
       while(it2.hasNext()){
    	   Map.Entry entry = (Map.Entry)it2.next();
    	  %>
							<option value="<%=entry.getKey() %>"><%=entry.getValue() %></option>
							<%
      }
  %>
						</select>
					</td>
				</tr>
				<tr>
					<td>
						跟单人
					</td>
					<td>
						<input type="text" id="findemployee"
							onclick="openwin('select_employees.jsp?p=1',400,400)" />
						<input type="hidden" id="employee" name="person1" />
					</td>
				</tr>
				<tr>
					<td>
						预计成交金额
					</td>
					<td>
						<input type="text" name="predict_amount"/>
						<select name="danwei">
							<option value="0">
								元
							</option>
							<option value="1">
								万元
							</option>
						</select>
					</td>
				</tr>
				<tr>
					<td>
						预计成交时间
					</td>
					<td>
						<input type="text" name="predict_time" maxlength="20"
							onclick="SelectDate(this,'yyyy-MM-dd')" readonly
							style="width: 100px; cursor: pointer" />
					</td>
				</tr>
				</table>
				<p style='text-align: center; font-weight:bold; margin:10px auto;'>产品</p>
				<table>
				<tr>
					<td>
						天成软件
					</td>
					<td>
						<textarea name="product1" style='height:40px; width:220px;'></textarea>
					</td>
				</tr>
				<tr>
					<td>
						第三方软件
					</td>
					<td>
						<textarea name="product2" style='height:40px; width:220px;'></textarea>
					</td>
				</tr>
				<tr>
					<td>
						相关硬件
					</td>
					<td>
						<textarea name="product3" style='height:40px; width:220px;'></textarea>
					</td>
				</tr>
				<tr>
					<td style='text-align: center;' colspan='2'>
						<input class='button' type="submit" value="提交">&nbsp;&nbsp;&nbsp;&nbsp;
						<input class='button' type="reset" value="重填">
					</td>
				</tr>
			</table>
		</form>
	</body>
</html>
